"""
Copyright © 2023 Walkline Wang (https://walkline.wang)
Gitee: https://gitee.com/walkline/micropython-ws2812-led-clock
"""
import os


def list_files(root='/'):
	files = []

	for dir in os.listdir(root):
		fullpath = ('' if root == '/' else root) + '/' + dir

		if os.stat(fullpath)[0] & 0x4000 != 0:
			files.extend(list_files(fullpath))
		else:
			if dir.endswith('.py'):
				files.append(fullpath)

	return files


if __name__ == '__main__':
	file_list = list_files()

	for file in file_list:
		try:
			os.remove(file)
		except:
			pass

